<?php
$level="";
$exp2="";
$points="";
$ech="";
$plevel="";
while(true)
{
$level="";
$exp2="";
$points="";
$query = "SELECT * FROM users WHERE login='$_COOKIE[login]'";
$cat = mysql_query ($query);
if(!$cat) exit (mysql_error());
while(list($id,$login,$pass,$mail,$reg,$class,$m,$h,$z,$s,$mon,$gold,$pms,$lvl,$ava,$ban,$online,$exp,$guild,$point) = mysql_fetch_row($cat))
{
$mcl=$class;
$level=$lvl;
$perms=$pms;
$exp2=$exp;
$points=$point;
}
$points=$points+10;
$nowlev=$level+1;
include "server_config.php";
$e="$level_exp";
for ( $i=0; $i<=$level; $i++)
{
$e=$e+$level_exp;
}
$e=$e*$level;
if($exp2>$e)
{
$plevel=$plevel+1;
$ech="<span style='color:green'>+$plevel уровень!</span><br>";
$query="UPDATE users SET lvl='$nowlev',point='$points' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
}
else if($exp2==$e)
{
$exp2x=$exp2+1;
$plevel=$plevel+1;
$ech="<span style='color:green'>+$plevel уровень!</span><br>";
$query="UPDATE users SET lvl='$nowlev',point='$points',exp='$exp2x' WHERE login='".$_COOKIE[login]."'";
$result=mysql_query($query)
or die("<span style='color:red'>ошибка обновления пользователя!</span><br>");
}
else
{
break;
}
}
echo "$ech";
?>